package com.ygo.feihua;

import android.content.*;
import android.graphics.*;
import android.view.*;
import android.widget.*;

import java.util.*;

public class Kdshitem extends BaseAdapter
{
	List<Map<String,Object>> data;
	Context context;
	private TextView kd_sh_name,kd_sh_dz,kd_sh_zt;
	int s=2;
	public Kdshitem(Context context, List<Map<String,Object>> data)
	{
		this.context = context;
		this.data=data;


	}
    

	public void addItem(Map<String,Object> map)
	{
		data.add(map);
		notifyDataSetChanged();
	}

	@Override
	public int getCount()
	{
		return data.size();
	}

	@Override
	public Object getItem(int position)
	{
		return data.get(position);
	}

	@Override
	public long getItemId(int position)
	{
		return position;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent)
	{
		View view = LayoutInflater.from(context).inflate(
			R.layout.kdshitem, null);
		kd_sh_name=(TextView) view.findViewById(R.id.kd_sh_name);
		kd_sh_dz=(TextView) view.findViewById(R.id.kd_sh_dz);
		kd_sh_zt=(TextView) view.findViewById(R.id.kd_sh_zt);
		kd_sh_name.setText((String)data.get(position).get("name"));
		kd_sh_dz.setText((String)data.get(position).get("dz"));
		s=(Integer) data.get(position).get("sh");
		switch(s){
			case 1:
				kd_sh_zt.setText("审核通过");
				kd_sh_zt.setTextColor(0xFF0DBD00);
				break;
			case 2:
				kd_sh_zt.setText("审核中");
				break;
			case 3:
				kd_sh_zt.setText("审核失败\n原因:"+(String)data.get(position).get("yy"));
				kd_sh_zt.setTextColor(Color.RED);
				
		}
		
		
		return view;
	}
	public void show(String s){
		Toast.makeText(context,s,Toast.LENGTH_SHORT).show();
	}

}
